<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>

<form:form commandName="message" cssClass="form-horizontal" role="form" onsubmit="return false">
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="taskName">任务名称</label>
        <div class="col-sm-3">
            <input type="text" name="taskName" id="taskName" value="${message.taskName}"
                   class="form-control" readonly>
        </div>
        <label class="col-sm-2 control-label no-padding-right" for="sendDeptName">反馈单位</label>
        <div class="col-sm-3">
            <input type="text" name="sendDeptName" id="sendDeptName" value="${message.sendDeptName}"
                   class="form-control" readonly>
            <%--<textarea rows="5" id="content" name="content"--%>
                      <%--class="form-control" readonly>${message.sendDeptName}</textarea>--%>
        </div>
    </div>

    <div class="form-group">
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="type">消息类型</label>
        <div class="col-sm-3">
            <input type="text" name="type" id="type" value="${message.type == 1 ?  "反馈" : "撤销申请"}"
                   class="form-control" readonly>
        </div>
        <label class="col-sm-2 control-label no-padding-right" for="state">读取状态</label>
        <div class="col-sm-3">
            <input type="text" name="state" id="state" value="${message.state == 1 ? "已读" : "未读"}"
                   class="form-control" readonly>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right">消息内容</label>
        <div class="col-sm-8">
            <textarea rows="3" class="form-control" readonly>${message.content}</textarea>
        </div>
    </div>
    <div class="form-group" id="addDepart">
        <div class="form-group">
            <label class="col-sm-2 control-label no-padding-right">转发人</label>
            <div class="col-sm-2">
                 <select class="form-control required" name="accepterId" <%--onchange="getChildDepart(this)"--%>>
                     <option value="">点击选择</option>
                     <c:forEach items="${list}" var="user">
                         <option  value="${user.userId}">${user.name}</option>
                     </c:forEach>
                 </select>
            </div>

        </div>
    </div>
    <input name="sysId" value="${message.sysId}" type="hidden">
</form:form>
<script src="<s:url value="/assets/js/chosen.jquery.js"></s:url>"></script>
<script src="<s:url value="/assets/js/ajaxfileupload.js"></s:url>"></script>
<script src="<s:url value="/assets/js/modal/modal.js"></s:url>"></script>

<script type="text/javascript">
    //下载按钮
    function downDetail(id) {
        var url = "/filesUpload/download/" + id;
        window.open(url);
    }

    $("#findBackList").click(function () {
        loadDialog({
            dialogTitle: '反馈信息列表',
            dialogUrl: "taskSend/backList/" + $('#sendId').text(),
            dialogFoot: '<button type="button" class="btn btn-default" data-dismiss="modal" id="showDetail">关闭</button>'
        });
    });
    function addDeparts(text) {
        if (text == null || text == 'undefined' || text == '') {
            text = $('#taskNew #categoryId').find('option:selected').text();
        }
        var remarkStr = 'list[' + departIndex + '].remark';
        var deptStr = 'list[' + departIndex + '].departName';
        var userIdStr = 'list[' + departIndex + '].userId';
        var html;

        if (text != null && text == '会议纪要') {
            html = '<div class="form-group">\n' +
                '<div class="form-group" style="margin:0px 0px 15px ">\n' +
                '    <label class="col-sm-2 control-label no-padding-right" for="' + remarkStr + '"><a style="color: red">*</a>议题内容</label>\n' +
                '    <div class="col-sm-8">\n' +
                '        <textarea type="text" name="' + remarkStr + '" id="' + remarkStr + '" placeholder="议题内容" \n' +
                '               class="form-control required"></textarea>\n' +
                '    </div>\n' +
                '</div>\n' +
                '    <label class="col-sm-2 control-label no-padding-right"><a style="color: red">*</a>承办单位</label>\n' +
                '    <div class="col-sm-2">\n' +
                '        <select class="form-control required" onchange="getChildDepart(this)">\n' + departCategoryOption +
                '        </select>\n' +
                '    </div>\n' +
                '    <div class="col-sm-3">\n' +
                '        <select class="form-control required" name="' + userIdStr + '" id="' + userIdStr + '" onchange="changeDepart(this)">\n' +
                '           <option value="">点击选择</option>\n' +
                '        </select>\n' +
                '        <input type="hidden" name="' + deptStr + '" id="' + deptStr + '" />\n' +
                '    </div>\n' +
                '    <div class="col-sm-1">\n' +
                '        <input type="button" value="删除" class="btn-sm btn-danger" />\n' +
                '    </div>\n' +
                '</div>';
        } else {
            html = '<div class="form-group">\n' +
                '    <label class="col-sm-2 control-label no-padding-right"><a style="color: red">*</a>承办单位</label>\n' +
                '    <div class="col-sm-2">\n' +
                '        <select class="form-control required" onchange="getChildDepart(this)">\n' + departCategoryOption +
                '        </select>\n' +
                '    </div>\n' +
                '    <div class="col-sm-3">\n' +
                '        <select name="' + userIdStr + '" id="' + userIdStr + '" class="form-control required" onchange="changeDepart(this)">\n' +
                '           <option value="">点击选择</option>\n' +
                '        </select>\n' +
                '        <input type="hidden" name="' + deptStr + '" id="' + deptStr + '" />\n' +
                '    </div>\n' +
                '    <div class="col-sm-1">\n' +
                '        <input type="button" value="删除" class="btn-sm btn-danger" />\n' +
                '    </div>\n' +
                '</div>';
        }
        $('#departContent').append(html);
        departIndex++;
    }
</script>
